package com.hlddz.venue_reservation.controller;


import com.hlddz.venue_reservation.entity.Venue;
import com.hlddz.venue_reservation.service.VenueService;
import com.hlddz.venue_reservation.util.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author MoShang
 * @since 2024年05月31日
 */
@RestController
@RequestMapping("/venue")
public class VenueController {
    @Resource
    private VenueService venueService;

    @GetMapping("/getVenueListByType")
    public Result getVenueListByType(@RequestParam("venueType") String venueType){
        List<Venue> venuesList = venueService.getVenueListByType(venueType);
        return Result.success(venuesList);
    }

    @GetMapping("/getVenueNameByType")
    public Result getVenueNameByType(@RequestParam("venueType") String venueType){
        String venueName = venueService.getVenueNameByType(venueType);
        return Result.success(venueName,"成功");
    }

    @GetMapping("/getVenueRemain")
    public Result getVenueRemainById(@RequestParam("venueId") Integer venueId){
        Integer venueRemain = venueService.getVenueRemainById(venueId);
        return Result.success(venueRemain);
    }
}

